Package jeresources.api.distributions
Class DistributionHelpers
java.lang.Object
jeresources.api.distributions.DistributionHelpers
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic float[]addDistribution(float[] base, float[] add) static float[]addDistribution(float[] base, float[] add, int offset) static DistributionBaseaddDistribution(DistributionBase base, DistributionBase add) static floatcalculateChance(int veinCount, int veinSize, int minY, int maxY) static intcalculateMeanLevel(float[] distribution, int mid) static intcalculateMeanLevel(float[] distribution, int mid, int oldMid, float difference) Deprecated.static float[]divideArray(float[] array, float num) static float[]static float[]static float[]getOverworldSurfaceDistribution(int oreDiameter) static float[]getRampDistribution(int minY, int maxY, float maxChance) static float[]getRampDistribution(int minY, int maxY, float minChance, float maxChance) static float[]getRoundedSquareDistribution(int min0, int minY, int maxY, int max0, float chance) static float[]getSquareDistribution(int minY, int maxY, float chance) static float[]getTriangularDistribution(int midY, int range, float maxChance) static float[]getTriangularDistribution(int minY, int rand1, int rand2, float maxChance) static float[]getUnderwaterDistribution(float chance) static float[]maxJoinArray(float[] array1, float[] array2) static float[]multiplyArray(float[] array, float num) static float[]reverse(float[] array) static floatsum(float[] distribution)
-
Field Details
-
PI
public static final float PI- See Also:
-
-
Constructor Details
-
DistributionHelpers
public DistributionHelpers()
-
-
Method Details
-
getTriangularDistribution
public static float[] getTriangularDistribution(int midY, int range, float maxChance) - Parameters:
midY- the top, middle of the trianglerange- length of the sidesmaxChance- chance at the top- Returns:
- an array of 320 floats in triangular distribution
-
getTriangularDistribution
public static float[] getTriangularDistribution(int minY, int rand1, int rand2, float maxChance) -
getSquareDistribution
public static float[] getSquareDistribution(int minY, int maxY, float chance) - Parameters:
minY- first occurrencemaxY- last occurrencechance- the chance- Returns:
- an array of 320 floats in square distribution
-
getRoundedSquareDistribution
public static float[] getRoundedSquareDistribution(int min0, int minY, int maxY, int max0, float chance) - Parameters:
min0- start of the rampminY- end of the ramp upmaxY- start of the ramp downmax0- end of ramp downchance- the chance at the top- Returns:
- an array of 320 floats in square distribution
-
getUnderwaterDistribution
public static float[] getUnderwaterDistribution(float chance) -
getRampDistribution
public static float[] getRampDistribution(int minY, int maxY, float minChance, float maxChance) - Parameters:
minY- first occurrencemaxY- last occurrenceminChance- change at the bottom of the rampmaxChance- chance at the top of the ramp- Returns:
- an array of floats with length |maxY - minY| in ramp distribution
-
getRampDistribution
public static float[] getRampDistribution(int minY, int maxY, float maxChance) -
getOverworldSurfaceDistribution
public static float[] getOverworldSurfaceDistribution(int oreDiameter) -
getOverworldSurface
public static float[] getOverworldSurface() -
addDistribution
public static float[] addDistribution(float[] base, float[] add) - Parameters:
base- base distributionadd- the to add distribution- Returns:
- the sum of both distributions
-
addDistribution
-
addDistribution
public static float[] addDistribution(float[] base, float[] add, int offset) - Parameters:
base- base distributionadd- the to add distributionoffset- the first element from the base array to start adding to- Returns:
- the sum of both distributions
-
reverse
public static float[] reverse(float[] array) - Parameters:
array- the float array to reverse- Returns:
- a reversed version of the given array
-
calculateMeanLevel
@Deprecated public static int calculateMeanLevel(float[] distribution, int mid, int oldMid, float difference) Deprecated. -
calculateMeanLevel
public static int calculateMeanLevel(float[] distribution, int mid) - Parameters:
distribution- the target arraymid- the "best guess" of the midpoint- Returns:
- the mid level of the distribution
-
divideArray
public static float[] divideArray(float[] array, float num) - Parameters:
array- the to divide arraynum- the denominator- Returns:
- the divided array
-
multiplyArray
public static float[] multiplyArray(float[] array, float num) - Parameters:
array- the to multiply arraynum- the multiplier- Returns:
- the divided array
-
maxJoinArray
public static float[] maxJoinArray(float[] array1, float[] array2) -
sum
public static float sum(float[] distribution) -
calculateChance
public static float calculateChance(int veinCount, int veinSize, int minY, int maxY) - Parameters:
veinCount- the amount of veins per chunkveinSize- the amount of blocks per veinminY- the lowest Y value for a veinmaxY- the highest Y value for a vein- Returns:
- the chance that a block appears within the specified Y boundaries
-
getDistributionFromPoints
-